
<!doctype html>
<%@ page language="java" pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/views-jsp/include/taglib/taglib.jsp" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ include file="/WEB-INF/views-jsp/include/link/link.jsp" %>
<%@ include file="/WEB-INF/views-jsp/include/script/script.jsp" %>
<!--
<script type="text/javascript" src="${path}/html/js/jquery-1.4.4.min.js"></script>
<script type="text/javascript" src="${path}/html/js/jquery.jqprint-0.3.js"></script>
-->
<html>
<head>
    <style type="text/css">
        table{ border:0px solid #CCCCCC; }
        table td{ text-align: center}
        table tr{ height:30px; line-height: 30px; }
        table textarea{width:100%; height:135px;  float:left;  border: 1px solid #CCCCCC}
        .radio{width:55px; height:30px; line-height: 30px;  float:left}
        .left_Panel{ width: 95%; margin: 0 auto; height: auto; margin-top: 5px; font-size: 10px;}
        .left_Panel .span{ font-size: 10px; padding-left: 5px;  line-height: 25px; }
        .panel-header .panel-title span {  margin: 0 0px;  }
    </style>
    <script type="text/javascript" src="${path}/html/js/js-resource/jsPdf/jspdf.debug.js"></script>
    <script type="text/javascript" src="${path}/html/js/js-resource/jsPdf/html2canvas.js"></script>
    <script type="text/javascript" src="${path}/html/js/js-jsp/workflow/purchase/view.js?v=<%out.print(Math.random());%>"></script>
</head>
<script>
    loading('流程数据加载中,请稍后...');
</script>

<body class="easyui-layout" id="viewBody">
    <input type="hidden" id="contractName" value="${purchaseApply.contract.coName}">
    <div class="easyui-layout" style="overflow: scroll;border:1px solid white" fit="true" id="mainId">
        <!--菜单页面-->
        <div data-options='region:"west", title:"&nbsp;", split:true, border:false' id="leftPanel" style="width:16%; overflow:scroll">
            <c:forEach items="${historicActivityInstances}" var="historicActivityInstance">
                <c:if test="${'startEvent' == historicActivityInstance.activityType}">
                    <div class="left_Panel" style="margin-top: 0px">
                        <div class="easyui-panel" title="<span style='font-size: 12px; font-weight: bold; color: #0E2D5F'>【${historicActivityInstance.activityName}】</span>" style="width:100%; height:100%" data-options="iconCls:'icon-edit'">
                            <p class="span">开始时间：<fmt:formatDate value="${historicActivityInstance.startTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                            <p class="span">办理用户：系统</p>
                            <p class="span">流程状态：开始</p>
                            <p class="span">结束时间：<fmt:formatDate value="${historicActivityInstance.endTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                        </div>
                    </div>
                </c:if>
                <c:if test="${'userTask' == historicActivityInstance.activityType}">
                    <div class="left_Panel">
                        <div class="easyui-panel" title="<span style='font-size: 12px; font-weight: bold; color: #0E2D5F'>【${historicActivityInstance.activityName}】</span>" style="width:100%; height:100%" data-options="iconCls:'icon-edit'">
                            <p class="span">开始时间：<fmt:formatDate value="${historicActivityInstance.startTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                            <p class="span">办理用户：${emNameMap[historicActivityInstance.assignee]}</p>
                            <c:forEach items="${comments}" var="comment">
                                <c:choose>
                                    <c:when test="${'comment' == comment.type and historicActivityInstance.processInstanceId == comment.processInstanceId and  historicActivityInstance.taskId == comment.taskId }">
                                        <p class="span">是否同意：${fn:substring(comment.message, 0, fn:indexOf(comment.message, "▲"))}</p>
                                        <p class="span">审核意见：${fn:substring(comment.message, fn:indexOf(comment.message, "▲") + 1, fn:length(comment.message))}</p>
                                    </c:when>
                                </c:choose>
                            </c:forEach>
                            <p class="span">结束时间：<fmt:formatDate value="${historicActivityInstance.endTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                        </div>
                    </div>
                </c:if>
                <c:if test="${'endEvent' == historicActivityInstance.activityType}">
                    <div class="left_Panel">
                        <div class="easyui-panel" title="<span style='font-size: 12px; font-weight: bold; color: #0E2D5F'>【${historicActivityInstance.activityName}】</span>" style="width:100%; height:100%" data-options="iconCls:'icon-edit'">
                            <p class="span">开始时间：<fmt:formatDate value="${historicActivityInstance.startTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                            <p class="span">办理用户：系统</p>
                            <p class="span">流程状态：结束</p>
                            <p class="span">结束时间：<fmt:formatDate value="${historicActivityInstance.endTime}" pattern="yyyy-MM-dd HH:mm:ss" /></p>
                        </div>
                    </div>
                </c:if>
            </c:forEach>
        </div>
        <!--内容页面-->
        <div data-options="region:'center', split:false" style="overflow: scroll" id="rightPanel">
            <table width="98%" style="height: 70px; border: none; text-align: center; ">
                <tr>
                    <td style="font-size: 26px; font-weight: bold">采购申请单</td>
                </tr>
            </table>

            <!--采购申请栏目信息-->
            <table id="easyuiDgApply" style="width:98%; overflow: hidden" class="easyui-datagrid" title="<span style='text-align: center; font-size: 14px; font-weight: bold; color: #0E2D5F'>申请栏【填写】</span>" data-options="singleSelect:true,  border: 0">
                <thead>
                <tr>
                    <th data-options="field:'option_apply_01',width: '16%', fixed: true">采购单号：</th>
                    <th data-options="field:'option_apply_02',width: '16%', fixed: true">${purchaseApply.purCode}</th>
                    <th data-options="field:'option_apply_03',width: '16%', fixed: true">申请用户：</th>
                    <th data-options="field:'option_apply_04',width: '16%', fixed: true">${purchaseApply.purPerson}</th>
                    <th data-options="field:'option_apply_05',width: '15%', fixed: true">申请时间：</th>
                    <th data-options="field:'option_apply_06',width: '15%'"><fmt:formatDate value="${purchaseApply.purDate}" pattern="yyyy-MM-dd HH:mm:ss" /></th>
                </tr>
                </thead>
            </table>

            <!--采购清单信息-->
            <table id="easyuiDgApplyDetail" style="width:98%" class="easyui-datagrid" title="采购清单信息" data-options="singleSelect:true,  border: 0">
                <thead>
                <tr>
                    <th data-options="field:'option_applyDetail_01',width: '12%', fixed: true">物料名称</th>
                    <th data-options="field:'option_applyDetail_02',width: '12%', fixed: true">材料品牌</th>
                    <th data-options="field:'option_applyDetail_03',width: '12%', fixed: true">规格型号</th>
                    <th data-options="field:'option_applyDetail_04',width: '10%', fixed: true">技术参数</th>
                    <th data-options="field:'option_applyDetail_05',width: '5.5%',  fixed: true">计量单位</th>
                    <th data-options="field:'option_applyDetail_06',width: '7%', fixed: true">合同单价</th>
                    <th data-options="field:'option_applyDetail_07',width: '8%', fixed: true">采购单价</th>
                    <th data-options="field:'option_applyDetail_08',width: '8%',  fixed: true">合同剩余量</th>
                    <th data-options="field:'option_applyDetail_09',width: '8%',  fixed: true">采购数量</th>
                    <th data-options="field:'option_applyDetail_10',width: '8%',  fixed: true">采购合计</th>
                </tr>
                </thead>
                <tbody>
                <c:set var="sumPurdTotalPrice" value="0" />
                <c:set var="sumPurdNum" value="0" />
                <c:forEach items="${purchaseDetails}" var="purchaseDetail">
                    <tr>
                        <td data-options="width: '12%', fixed: true">${purchaseDetail.material.materialName}</td>
                        <td data-options="width: '12%', fixed: true">${purchaseDetail.material.brand}</td>
                        <td data-options="width: '12%', fixed: true">${purchaseDetail.material.standardType}</td>
                        <td data-options="width: '10%', fixed: true">${purchaseDetail.material.technicalParameter}</td>
                        <td data-options="width: '5.9%', fixed: true">${purchaseDetail.material.meteringUnit}</td>
                        <td data-options="width: '7%', fixed: true"><fmt:formatNumber value="${purchaseDetail.contract.unitContractPrice == null?0:purchaseDetail.contract.unitContractPrice}" pattern="#,#00.0#"/></td>
                        <td data-options="width: '8%', fixed: true"><fmt:formatNumber value="${purchaseDetail.material.unitPrice}" pattern="#,#00.0#"/></td>
                        <td data-options="width: '8%', fixed: true">${purchaseDetail.contract.leftCount}</td>
                        <td data-options="width: '8%', fixed: true">${purchaseDetail.purdNum}</td>
                        <td data-options="width: '8%'"><fmt:formatNumber value="${purchaseDetail.purdTotalPrice}" pattern="#,#00.0#"/></td>
                    </tr>
                    <c:set var="sumPurdTotalPrice" value="${sumPurdTotalPrice  + purchaseDetail.purdTotalPrice}" />
                    <c:set var="sumPurdNum" value="${sumPurdNum  + purchaseDetail.purdNum}" />
                </c:forEach>
                <c:if test="${empty purchaseDetails}" >
                    <tr>
                        <td colspan="10" style="text-align: center;">暂无采购清单信息!</td>
                    </tr>
                </c:if>
                </tbody>
            </table>

            <!--采购统计信息-->
            <table id="easyuiDgSum" style="width:98%" class="easyui-datagrid" data-options="singleSelect:true,  border: 0">
                <thead>
                <tr>
                    <th data-options="field:'option_sum_01',width: '16%', fixed: true"><span style="font-weight: bold">采购总数量：</span></th>
                    <th data-options="field:'option_sum_02',width: '82%', align: 'left'">${sumPurdNum}</th>
                </tr>
                <tr>
                    <th data-options="field:'option_sum_03',width: '16%', fixed: true"><span style="font-weight: bold">采购总金额：</span></th>
                    <th data-options="field:'option_sum_04',width: '82%', align: 'left'"><fmt:formatNumber value="${sumPurdTotalPrice}" pattern="#,#00.0#"/> 元</th>
                </tr>
                </thead>
            </table>

            <!--采购附件信息-->
            <table id="easyuiDgFile" style="width:98%" class="easyui-datagrid"  title="采购附件信息" data-options="border: 0">
                <thead>
                <tr>
                    <th data-options="field:'option_file_01',width: '30%', fixed: true">附件名称</th>
                    <th data-options="field:'option_file_02',width: '68%', align: 'left'">操作</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${commonFiles}" var="commonFile">
                    <tr>
                        <td data-options="field:'option_file_01',width: '30%', fixed: true">${commonFile.name}</td>
                        <td data-options="field:'option_file_02',width: '68%', align: 'left'">
                            <a id="downFile" class="easyui-linkbutton c1" onclick="commonFile_down('${commonFile.fileId}')" style="width:60px; height: 28px" >下载</a>&nbsp;&nbsp;
                            <a id="delFile" class="easyui-linkbutton c1" onclick="commonFile_del('${commonFile.fileId}', '${commonFile.name}')" disabled="disabled" style="width:60px; height: 28px">删除</a>
                        </td>
                    </tr>
                </c:forEach>
                <c:if test="${empty commonFiles}" >
                    <tr>
                        <td>暂无采购附件信息！</td>
                    </tr>
                </c:if>
                </tbody>
            </table>
            <div style="page-break-before:always;"></div>
            <!--采购审批流程信息-->
            <c:forEach items="${historicTaskInstances}" var="historicTaskInstance">
                <table class="easyui-datagrid" style="width:98%" title="<span style='text-align: center; font-size: 14px; font-weight: bold; color: #0E2D5F'>${historicTaskInstance.name}【审批】</span>" data-options="singleSelect:true,  border: 0">
                    <c:if test="${null == historicTaskInstance.endTime}">
                        <thead>
                        <tr>
                            <th data-options="field:'option_workflow_01',width: '16%', fixed: true">是否同意：</th>
                            <th data-options="field:'option_workflow_02',width: '82%'">
                                <div class="radio">
                                    <input type="radio" name="radio02" value="1" disabled="disabled" />同意
                                </div>
                                <div class="radio">
                                    <input type="radio" name="radio02" value="2" disabled="disabled" />不同意
                                </div>
                            </th>
                        </tr>
                        <tr>
                            <th data-options="field:'option_workflow_01',width: '16%', fixed: true">审核意见：</th>
                            <th data-options="field:'option_workflow_02',width: '82%'">
                                <textarea rows="5" cols="50" disabled="disabled" ></textarea>
                            </th>
                        </tr>
                        </thead>
                    </c:if>
                    <c:if test="${null != historicTaskInstance.endTime}">
                        <c:forEach items="${comments}" var="comment">
                            <thead>
                            <c:if test="${historicTaskInstance.processInstanceId == comment.processInstanceId and historicTaskInstance.id == comment.taskId }">
                                <c:set var="isChecked" value="${fn:substring(comment.message, 0, fn:indexOf(comment.message, '▲'))}" />
                                <c:set var="isCheckedMessage" value="${fn:substring(comment.message, fn:indexOf(comment.message, '▲') + 1, fn:length(comment.message))}" />
                                <tr>
                                    <th data-options="field:'optoion_4_01',width: '16%', fixed: true">是否同意：</th>
                                    <th data-options="field:'optoion_4_02',width: '82%'">
                                        <div class="radio">
                                            <input type="radio" name="${comment.taskId}" value="1" disabled="disabled" ${'同意' == isChecked ? 'checked="checked"' : '' } />同意
                                        </div>
                                        <div class="radio">
                                            <input type="radio" name="${comment.taskId}" value="1" disabled="disabled" ${'不同意' == isChecked ? 'checked="checked"' : '' } />不同意
                                        </div>
                                    </th>
                                </tr>
                                <tr>
                                    <th data-options="field:'optoion_4_01',width: '16%', fixed: true">审核意见：</th>
                                    <th data-options="field:'optoion_4_02',width: '82%'">
                                        <textarea rows="5" cols="50" disabled="disabled">${isCheckedMessage}</textarea>
                                    </th>
                                </tr>
                                <c:set var="isCheckedMessage" value="" />
                            </c:if>
                            </thead>
                        </c:forEach>
                    </c:if>
                </table>
            </c:forEach>
            <!--操作按钮-->
            <table style="height: 80px; width: 98%">
                <tr>
                    <td>
                        <div class="formbody">
                            <div style="width: 100%">
                                <a id="closeBtn" class="easyui-linkbutton c1" style="width:100px; height: 35px;  margin: 0 auto">关闭</a> &nbsp;&nbsp;
                                <a id="printBtn" class="easyui-linkbutton c1" onclick="printFun()" style="width:100px; height: 35px; margin: 0 auto">打印</a>
                            </div>
                        </div>
                    </td>
                </tr>
            </table>
        </div>
    </div>
    <script type="text/javascript" src="${path}/html/js/Print.js"></script>
    <script type="text/javascript">
        window.parent.disLoading('taskWindow');
    </script>
</body>
</html>

